//
//  SingleHRVRResultView.swift
//  DaRings
//
//  Created by 易先生 on 2023/2/18.
//

import UIKit
import MYModule

class SingleHRVRResultView: View {


    override func makeUI() {
        super.makeUI()
        
        self.addSubview(titleLabel)
        self.addSubview(dateLabel)
        self.addSubview(hrvLabel)
        self.addSubview(unitLabel)
        
        let hrvStackView = StackView()
        hrvStackView.axis = .horizontal
        hrvStackView.alignment = .lastBaseline
        hrvStackView.addArrangedSubview(hrvLabel)
        hrvStackView.addArrangedSubview(unitLabel)
        self.addSubview(hrvStackView)

        titleLabel.snp.makeConstraints { make in
            make.top.leading.equalToSuperview().offset(20)
        }
        
        dateLabel.snp.makeConstraints { make in
            make.top.equalTo(titleLabel.snp.bottom).offset(8)
            make.leading.equalTo(titleLabel)
            make.bottom.equalToSuperview().offset(-20)
        }
        
        hrvStackView.snp.makeConstraints { make in
            make.trailing.equalToSuperview().offset(-20)
            make.centerY.equalToSuperview()
        }
        
        let lineView = View()
        lineView.backgroundColor = UIColor.assist_D0D0D0
        self.addSubview(lineView)
        
        lineView.snp.makeConstraints { make in
            make.leading.equalToSuperview().offset(20)
            make.bottom.centerX.equalToSuperview()
            make.height.equalTo(0.5)
        }

    }
    
    public lazy var titleLabel: Label = {
        let titleLabel = Label()
        titleLabel.textColor = UIColor.assist_222222
        titleLabel.font = Fonts.boldSystemFont(ofSize: 20)
        return titleLabel
    }()
    
    public lazy var dateLabel: Label = {
        let dateLabel = Label()
        dateLabel.textColor = UIColor.assist_222222
        dateLabel.font = Fonts.systemFont(ofSize: 12)
        return dateLabel
    }()
    
    public lazy var hrvLabel: Label = {
        let hrvLabel = Label()
        hrvLabel.textColor = UIColor.assist_222222
        hrvLabel.font = Fonts.boldSystemFont(ofSize: 40)
        return hrvLabel
    }()

    public lazy var unitLabel: Label = {
        let unitLabel = Label()
        unitLabel.font = Fonts.systemFont(ofSize: 12)
        unitLabel.textColor = UIColor.assist_222222
        return unitLabel
    }()

}
